package trabajoISW2.tests;


import org.junit.Before;
import org.junit.Test;

import trabajoISW2.domain.contracts.IAddress;
import trabajoISW2.domain.exceptions.NoPositiveNumberException;
import trabajoISW2.domain.exceptions.WrongIdException;
import trabajoISW2.domain.exceptions.WrongNameException;
import trabajoISW2.domain.implementations.Address;


public class AddressTestSuite {

	IAddress a;
	
	@Before
	public void setup(){
		a = new Address();
	}
	
	
	//Tests de setAddressId
	
	@Test
	public void testSetAddressId(){
		a.setAddressId(0);
		a.setAddressId(1);
		a.setAddressId(Integer.MAX_VALUE);
		a.setAddressId(Integer.MAX_VALUE-1);
	}
	
	@Test(expected = WrongIdException.class)
	public void testSetAddressId1(){
		a.setAddressId(-1);
	}
	
	@Test(expected = WrongIdException.class)
	public void testSetAddressId2(){
		a.setAddressId(Integer.MIN_VALUE);
	}
	
	@Test(expected = WrongIdException.class)
	public void testSetAddressId3(){
		a.setAddressId(Integer.MIN_VALUE+1);
	}
	
	
	//Tests de setAddress
	
	@Test
	public void testSetAddress(){
		a.setAddress("prueba");
				
	}
	
	@Test(expected = WrongNameException.class)
	public void testSetAddress1(){
		a.setAddress(null);
	}
	@Test(expected = WrongNameException.class)
	public void testSetAddress2(){
		a.setAddress("");
	}
	
	
	//Tests de setZipCode
		
	@Test
	public void testSetZipCode(){
		a.setZipCode(2222);
		a.setZipCode(1);
		a.setZipCode(Integer.MAX_VALUE);
		a.setZipCode(Integer.MAX_VALUE - 1);
	}
	
	@Test(expected = NoPositiveNumberException.class)
	public void testSetZipCode1(){
		a.setZipCode(0);
	}
	
	@Test(expected = NoPositiveNumberException.class)
	public void testSetZipCode2(){
		a.setZipCode(-1);
	}
	
	@Test(expected = NoPositiveNumberException.class)
	public void testSetZipCode3(){
		a.setZipCode(Integer.MIN_VALUE);
	}
	
	@Test(expected = NoPositiveNumberException.class)
	public void testSetZipCode4(){
		a.setZipCode(Integer.MIN_VALUE+1);
	}
	
	
	
	//Tests de setCity
	
	@Test
	public void testSetCity(){
		a.setCity("prueba");
				
	}
	
	@Test(expected = WrongNameException.class)
	public void testSetCity1(){
		a.setCity(null);
	}
	@Test(expected = WrongNameException.class)
	public void testSetCity2(){
		a.setCity("");
	}
	
	
	//Tests de setCountry
	
	@Test
	public void testSetCountry(){
		a.setCountry("prueba");
				
	}
	
	@Test(expected = WrongNameException.class)
	public void testSetCountry1(){
		a.setCountry(null);
	}
	@Test(expected = WrongNameException.class)
	public void testSetCountry2(){
		a.setCountry("");
	}
	
	
	

}
